package com.sinder.campus_prophet.core.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * swagger2接口文档
 * @author xieyingde
 */
@Configuration
@EnableSwagger2
public class Swagger2Config {
    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .select()
                //swagger要扫描的包路径
                .apis(RequestHandlerSelectors.basePackage("com.sinder.campus_prophet"))
                .paths(PathSelectors.any())
                .build().apiInfo(new ApiInfoBuilder()
                        .title("'理先知小程序'接口文档")
                        .description("理先知小程序接口文档")
                        .version("1.0v")
                        .contact(new Contact("sinder","https://yj.xiesinder.cn","597241326@qq.com"))
                        .build()
                );

    }
}
